package part3;

public interface HandlerAdapter {
    void handle(Object handler);
    boolean support(Object handler);
}

class HttpHandlerAdapter implements HandlerAdapter {
    public void handle(Object handler) {
        ((HttpController) handler).doHttpHandler();
    }

    public boolean support(Object handler) {
        return (handler instanceof HttpController); // 如果它是继承自http请求接口的
    }
}

class SimpleHandlerAdapter implements HandlerAdapter {
    public void handle(Object handler) {
        ((SimpleController) handler).doSimpleHandler();
    }

    public boolean support(Object handler) {
        return (handler instanceof SimpleController); // 如果它是继承自简单请求接口的
    }
}

class AnnotationHandlerAdapter implements HandlerAdapter {
    public void handle(Object handler) {
        ((AnnotationController) handler).doAnnotationHandler();
    }

    public boolean support(Object handler) {
        return (handler instanceof AnnotationController); // 如果它是继承自annotation请求接口的
    }
}